package com.kingpeng.rxjava_sample;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity {

    Class[] mAtys = new Class[]{RxJavaAty.class};
    @BindView(R.id.ll_containt)
    LinearLayout mContaint;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        initButton();
    }

    private void initButton() {
        Button button;
        for (final Class aty : mAtys) {
            button = new Button(this);
            button.setText(aty.getSimpleName());
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    MainActivity.this.startActivity(new Intent(MainActivity.this, aty));
                }
            });
            mContaint.addView(button);
        }
    }
}
